package chapter03;

public class Test07_CodeFramgent {
    public static void main(String[] args) {
        Student2 s1 = new Student2("张三",10);
        Student2 s2 = new Student2("李四",20);
    }
}
class Student2{
    {
        //每一个新建对象 就会调用一次
        System.out.println("我是构造代码块");
    }
    static {//只有在类加载的时候执行一次 然后就不执行了
        System.out.println("我是静态代码块");
    }
    private String name;
    private int age;
    public Student2(String name,int age){
        this.name = name;
        this.age = age;
    }
}
